// Copyright 2020 The docker-demo Authors. All rights reserved.

// Project: docker-demo
// IDE: GoLand
// Author: fucaihe@gmail.com
// File: main.go
// Date: 2020/8/11 15:53
// Description: go 程序跑在 docker 里面

package main

import (
	"fmt"
	"strings"
	"time"

	"docker-demo/internal/setting"

	"github.com/yanyiwu/gojieba"
)

func main() {

	if err := setting.Setup(""); err != nil {
		panic(err)
	}

	var words []string
	x := gojieba.NewJieba()
	defer x.Free()

	for {
		fmt.Println("hello ", setting.Config.App.Hello)
		s := "我来到北京清华大学"
		words = x.Cut(s, true)
		fmt.Println("精确模式:", strings.Join(words, "/"))

		topWordWeightArr := x.ExtractWithWeight(s, 3)
		fmt.Println(topWordWeightArr)

		time.Sleep(5 * time.Second)
	}
}
